<?php

namespace App\Model;

use App\Util\ImUtil;
use Illuminate\Database\Eloquent\Model;

/**
 *  取消黑名单记录
 */
class CancelBlackLog extends Model
{
    protected $table = 'cancel_black_log';

    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s'
    ];

    public static function delBlack($userId, $blackUserId)
    {
        UserBlacklist::removeRecord($userId, $blackUserId);

        $users = User::getImAccounts([$userId, $blackUserId]);

        ImUtil::delBlackList($users[$userId], $users[$blackUserId]);

        return true;
    }
}
